900 |
How do I get ride of the separator items when the user performs grouping
// AddGroupItem event - Occurs after a new Group Item has been inserted to Items collection. procedure TWinForm1.AxGrid1_AddGroupItem(sender: System.Object; e: AxEXGRIDLib._IGridEvents_AddGroupItemEvent); begin with AxGrid1 do begin Items.ItemDividerLine[e.item] := EXGRIDLib.DividerLineEnum.EmptyLine; end end; with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := False; rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset); with rs do begin Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil); end; DataSource := (rs as ADODB.Recordset); SortBarVisible := True; SortBarCaption := 'Drag a <b>column</b> header here to group by that column.'; AllowGroupBy := True; Columns.Item[TObject(1)].SortOrder := EXGRIDLib.SortOrderEnum.SortAscending; LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exGroupLinesOutside; EndUpdate(); end |
899 |
How do I split a cell in three parts, and having a radio button in each of them
// CellStateChanged event - Fired after cell's state has been changed. procedure TWinForm1.AxGrid1_CellStateChanged(sender: System.Object; e: AxEXGRIDLib._IGridEvents_CellStateChangedEvent); begin with AxGrid1 do begin OutputDebugString( Items.CellCaption[TObject(e.item),TObject(e.colIndex)] ); end end; // Click event - Occurs when the user presses and then releases the left mouse button over the grid control. procedure TWinForm1.AxGrid1_ClickEvent(sender: System.Object; e: System.EventArgs); begin with AxGrid1 do begin h := get_ItemFromPoint(-1,-1,c,hit); Items.CellState[TObject(h),TObject(c)] := 1; end end; with AxGrid1 do begin BeginUpdate(); FullRowSelect := EXGRIDLib.CellSelectEnum.exColumnSel; SelBackColor := BackColor; SelForeColor := ForeColor; DrawGridLines := EXGRIDLib.GridLinesEnum.exAllLines; ShowFocusRect := False; (Columns.Add('Default') as EXGRIDLib.Column).Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); with Items do begin h := AddItem('entire'); h := AddItem('Radio <b>1'); CellRadioGroup[TObject(h),TObject(0)] := 100; CellHasRadioButton[TObject(h),TObject(0)] := True; CellState[TObject(h),TObject(0)] := 1; h := SplitCell[TObject(h),TObject(0)]; CellValue[TObject(0),TObject(h)] := 'Radio <b>2'; CellRadioGroup[TObject(0),TObject(h)] := 100; CellHasRadioButton[TObject(0),TObject(h)] := True; h := SplitCell[TObject(0),TObject(h)]; CellValue[TObject(0),TObject(h)] := 'Radio <b>3'; CellRadioGroup[TObject(0),TObject(h)] := 100; CellHasRadioButton[TObject(0),TObject(h)] := True; h := AddItem('entire'); end; EndUpdate(); end |
898 |
Does your grid include a row indicator , like an arrow, bullet
// SelectionChanged event - Fired after a new item has been selected. procedure TWinForm1.AxGrid1_SelectionChanged(sender: System.Object; e: System.EventArgs); begin with AxGrid1 do begin with Items do begin hFocusItem := FocusItem; CellValue[AxGrid1.Columns.Item['active'].Data,'active'] := ''; CellValue[TObject(hFocusItem),'active'] := '<c><font symbol>·'; CellVAlignment[TObject(hFocusItem),'active'] := EXGRIDLib.VAlignmentEnum.exBottom; AxGrid1.Columns.Item['active'].Data := TObject(hFocusItem); end; end end; with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := False; rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset); with rs do begin Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil); end; DataSource := (rs as ADODB.Recordset); ShowFocusRect := False; ContinueColumnScroll := True; ScrollBySingleLine := True; AutoDrag := Integer(EXGRIDLib.AutoDragEnum.exAutoDragScrollOnShortTouch) Or Integer(EXGRIDLib.AutoDragEnum.exAutoDragScroll); with (Columns.Add('') as EXGRIDLib.Column) do begin Key := 'active'; Position := 0; AllowSizing := False; Width := 12; Data := TObject(AxGrid1.Items.FocusItem); Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); end; CountLockedColumns := 1; with Items do begin SelectItem[NextVisibleItem[FocusItem]] := True; end; EndUpdate(); end |
897 |
How can I connect to a DBF file
with AxGrid1 do begin ColumnAutoResize := False; ContinueColumnScroll := False; rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADODB.Recordset')) as ADODB.Recordset); with rs do begin Open('Select * From foxcode.DBF','Provider=vfpoledb;Data Source=C:\Program Files\Microsoft Visual FoxPro 9\',3,3,Nil); end; DataSource := (rs as ADODB.Recordset); end |
896 |
Does your control supports scrolling by touching the screen
with AxGrid1 do begin ColumnAutoResize := False; rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset); with rs do begin Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil); end; DataSource := (rs as ADODB.Recordset); ContinueColumnScroll := True; ScrollBySingleLine := True; AutoDrag := Integer(EXGRIDLib.AutoDragEnum.exAutoDragScrollOnShortTouch) Or Integer(EXGRIDLib.AutoDragEnum.exAutoDragScroll); end |
895 |
How do I prevent showing the control's BackColorAlternate property on empty / non-items part of the control
with AxGrid1 do begin BeginUpdate(); (GetOcx() as EXGRIDLib.Grid).BackColorAlternate := $7ff0f0f0; Columns.Add('Column'); with Items do begin AddItem('Item 1'); AddItem('Item 2'); AddItem('Item 3'); AddItem('Item 4'); AddItem('Item 5'); end; EndUpdate(); end |
894 |
Is there any method for reading information from the root item for the current item...
with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; SearchColumnIndex := 0; Columns.Add('Info'); with Items do begin PathSeparator := ' ; '; SelectItem[InsertItem(InsertItem(InsertItem(InsertItem(Nil,Nil,'Root'),Nil,'Child'),Nil,'Sub-Child'),Nil,'Sub-Sub-Child')] := True; ExpandItem[0] := True; OutputDebugString( FullPath[FocusItem] ); end; EndUpdate(); end |
893 |
How can I highlight items with a specified date
with AxGrid1 do begin BeginUpdate(); with Columns do begin Add('Tasks'); with (Add('Date') as EXGRIDLib.Column) do begin SortType := EXGRIDLib.SortTypeEnum.SortDate; Editor.EditType := EXGRIDLib.EditTypeEnum.SpinType; end; end; with Items do begin CellValue[TObject(AddItem('Task 1')),TObject(1)] := '12/13/2001'; CellValue[TObject(AddItem('Task 2')),TObject(1)] := '12/14/2001'; CellValue[TObject(AddItem('Task 2')),TObject(1)] := '12/15/2001'; end; ConditionalFormats.Add('%1 = #12/14/2001#',Nil).Bold := True; EndUpdate(); end |
892 |
Today date is shown, if we use the Column.FormatColumn and Editor.Option(exDateAllowNullDate) properties. What can be done
with AxGrid1 do begin BeginUpdate(); with (Columns.Add('Date') as EXGRIDLib.Column) do begin FormatColumn := 'len(value) ? ( (longdate(date(value)) left 3) + '' '' + day(date(value)) + ''/'' + month(date(value)) + ''/'' + (year(date(value)) rig' + 'ht 2) ) : '''' )'; with Editor do begin EditType := EXGRIDLib.EditTypeEnum.DateType; Option[EXGRIDLib.EditorOptionEnum.exDateAllowNullDate] := TObject(True); end; end; with Items do begin AddItem('5/12/2012'); AddItem(Nil); AddItem('5/14/2012'); end; EndUpdate(); end |
891 |
How can I add multiple values/columns on the same line/item/row
// Change event - Occurs when the user changes the cell's content. procedure TWinForm1.AxGrid1_Change(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ChangeEvent); begin with AxGrid1 do begin Refresh(); end end; with AxGrid1 do begin BeginUpdate(); SortOnClick := EXGRIDLib.SortOnClickEnum.exNoSort; LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exGroupLinesOutside; Indent := 13; HeaderVisible := False; LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; with Columns do begin Add('Items'); (Add('Quantity') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.SpinType; (Add('Value') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.SpinType; end; with Items do begin h := AddItem('Items'); CellValue[TObject(h),TObject(2)] := 'sum(current,dir,dbl(%1)*dbl(%2))'; CellValueFormat[TObject(h),TObject(2)] := EXGRIDLib.ValueFormatEnum.exTotalField; FormatCell[TObject(h),TObject(2)] := '`Total: `+ value'; CellHAlignment[TObject(h),TObject(2)] := EXGRIDLib.AlignmentEnum.RightAlignment; CellBold[TObject(h),TObject(2)] := True; CellEditorVisible[TObject(h),TObject(2)] := EXGRIDLib.EditorVisibleEnum.exEditorHidden; CellEditorVisible[TObject(h),TObject(1)] := EXGRIDLib.EditorVisibleEnum.exEditorHidden; h1 := InsertItem(h,Nil,'Item 1'); CellValue[TObject(h1),TObject(1)] := TObject(10); CellValue[TObject(h1),TObject(2)] := TObject(3); h1 := InsertItem(h,Nil,'Item 2'); CellValue[TObject(h1),TObject(1)] := TObject(20); CellValue[TObject(h1),TObject(2)] := TObject(4); ExpandItem[h] := True; end; EndUpdate(); end |
890 |
Is there a syntax for conditional formatting of items, based on CellState/CellStateChange
// CellStateChanged event - Fired after cell's state has been changed. procedure TWinForm1.AxGrid1_CellStateChanged(sender: System.Object; e: AxEXGRIDLib._IGridEvents_CellStateChangedEvent); begin with AxGrid1 do begin with Items do begin CellValue[TObject(e.item),TObject(2)] := TObject(CellState[TObject(e.item),TObject(0)]); end; end end; with AxGrid1 do begin BeginUpdate(); ShowFocusRect := False; SelBackMode := EXGRIDLib.BackModeEnum.exTransparent; var_ConditionalFormat := ConditionalFormats.Add('%2 != 0',Nil); with var_ConditionalFormat do begin Bold := True; ForeColor := $ff; ApplyTo := EXGRIDLib.FormatApplyToEnum.exFormatToItems; end; with (Columns.Add('') as EXGRIDLib.Column) do begin Def[EXGRIDLib.DefColumnEnum.exCellHasCheckBox] := TObject(True); Width := 16; AllowSizing := False; end; Columns.Add('Information'); (Columns.Add('Hidden') as EXGRIDLib.Column).Visible := False; with Items do begin CellValue[TObject(AddItem('')),TObject(1)] := 'This is a bit of text associated'; h := AddItem(''); CellValue[TObject(h),TObject(1)] := 'This is a bit of text associated'; CellState[TObject(h),TObject(0)] := 1; CellValue[TObject(AddItem('')),TObject(1)] := 'This is a bit of text associated'; end; EndUpdate(); end |
889 |
How do I programatically focus a cell
// FocusChanged event - Occurs when a new cell is focused. procedure TWinForm1.AxGrid1_FocusChanged(sender: System.Object; e: System.EventArgs); begin with AxGrid1 do begin with Items do begin CellBackColor[TObject(FocusItem),TObject(AxGrid1.FocusColumnIndex)] := $ff; end; end end; with AxGrid1 do begin BeginUpdate(); SelForeColor := ForeColor; SelBackColor := BackColor; DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines; with Columns do begin Add('Column1'); Add('Column2'); end; with Items do begin CellValue[TObject(AddItem('Cell 1.1')),TObject(1)] := 'Cell 1.2'; CellValue[TObject(AddItem('Cell 2.1')),TObject(1)] := 'Cell 2.2'; end; with Items do begin SelectItem[ItemByIndex[1]] := True; end; FocusColumnIndex := 1; EndUpdate(); end |
888 |
How do I programatically focus a cell (excrd)
// FocusChanged event - Occurs when a new cell is focused. procedure TWinForm1.AxGrid1_FocusChanged(sender: System.Object; e: System.EventArgs); begin with AxGrid1 do begin with Items do begin CellBackColor[TObject(FocusItem),TObject(AxGrid1.FocusColumnIndex)] := $ff; end; end end; with AxGrid1 do begin BeginUpdate(); SelForeColor := ForeColor; SelBackColor := BackColor; DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines; DefaultItemHeight := 36; with Columns do begin (Add('Column1') as EXGRIDLib.Column).Visible := False; (Add('Column2') as EXGRIDLib.Column).Visible := False; (Add('Column3') as EXGRIDLib.Column).Visible := False; with (Add('FormatLevel') as EXGRIDLib.Column) do begin FormatLevel := '(0/1),2'; Def[EXGRIDLib.DefColumnEnum.exCellFormatLevel] := TObject(FormatLevel); end; end; with Items do begin h := AddItem('Cell 1.1'); CellValue[TObject(h),TObject(1)] := 'Cell 1.2'; CellValue[TObject(h),TObject(2)] := 'Cell 1.3'; h := AddItem('Cell 2.1'); CellValue[TObject(h),TObject(1)] := 'Cell 2.2'; CellValue[TObject(h),TObject(2)] := 'Cell 2.3'; end; with Items do begin SelectItem[ItemByIndex[1]] := True; end; FocusColumnIndex := 2; EndUpdate(); end |
887 |
How do I programmatically exclude items from the filter
with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; with (Columns.Add('Items') as EXGRIDLib.Column) do begin DisplayFilterButton := True; DisplayFilterPattern := False; FilterList := Integer(EXGRIDLib.FilterListEnum.exShowExclude) Or Integer(EXGRIDLib.FilterListEnum.exShowFocusItem) Or Integer(EXGRIDLib.FilterListEnum.exShowCheckBox); end; with Items do begin AddItem('Item 1'); AddItem('Item 2'); AddItem('Item 3'); AddItem('Item 4'); end; with Columns.Item[TObject(0)] do begin FilterType := Integer(EXGRIDLib.FilterTypeEnum.exFilterExclude) Or Integer(EXGRIDLib.FilterTypeEnum.exFilter); Filter := 'Item 1|Item 4'; end; ApplyFilter(); EndUpdate(); end |
886 |
Using the property Column.FormatColumn I want to display numbers in the numeric format with no decimals - unless the value is NULL then I want to display a blank or empty
with AxGrid1 do begin BeginUpdate(); with Columns do begin (Add('Format') as EXGRIDLib.Column).FormatColumn := 'len(value) ? (value format ''0'') : '''' '; end; with Items do begin AddItem(TObject(10)); AddItem(Nil); AddItem(TObject(-8)); end; EndUpdate(); end |
885 |
How can I change the drop down filter background color
with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; set_Background(EXGRIDLib.BackgroundPartEnum.exBackColorFilter,$ffffff); with (Columns.Add('Items') as EXGRIDLib.Column) do begin DisplayFilterButton := True; DisplayFilterPattern := False; FilterList := Integer(EXGRIDLib.FilterListEnum.exShowFocusItem) Or Integer(EXGRIDLib.FilterListEnum.exShowCheckBox) Or Integer(EXGRIDLib.FilterListEnum.exSortItemsAsc) Or Integer(EXGRIDLib.FilterListEnum.exLeafItems); end; with Items do begin h := AddItem('Root 1'); InsertItem(h,Nil,'Child 1'); InsertItem(h,Nil,'Child 2'); ExpandItem[h] := True; h := AddItem('Root 2'); InsertItem(h,Nil,'Child 1'); InsertItem(h,Nil,'Child 2'); InsertItem(h,Nil,'Child 3'); ExpandItem[h] := True; end; EndUpdate(); end |
884 |
I am using AllowGroupBy property and calling the Column.SortOrder property groups by that column. Is it possible to prevent that, so I have a similar behavior like I click the column's header rather than dragging it to the control's GroupBy bar
with AxGrid1 do begin with Columns do begin Add('First'); Add('Second'); Add('Third'); end; SortBarVisible := True; SingleSort := False; AllowGroupBy := True; Layout := 'SingleSort = "C0:1";MultipleSort = "C1:2 C2:1"'; end |
883 |
Calling programatically the Column.SortOrder property adds the column to the sort bar. Is it possible to prevent that, so I have a similar behavior like I click the column's header rather than dragging it to the control's Sort bar
with AxGrid1 do begin with Columns do begin Add('First'); Add('Second'); Add('Third'); end; SortBarVisible := True; SingleSort := False; Layout := 'SingleSort = "C0:1"'; end |
882 |
How do I restore/clear the HotBackColor/HotForeColor properties
with AxGrid1 do begin BeginUpdate(); HotBackColor := Color.FromArgb(0,0,255); HotForeColor := Color.FromArgb(255,255,255); (Columns.Add('Value') as EXGRIDLib.Column).Visible := False; with (Columns.Add('USD') as EXGRIDLib.Column) do begin Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); FormatColumn := 'len(%0) ? ((0:=dbl(%0)) < 10 ? ''<fgcolor=808080><font ;7>'' : ''<b>'') + `USD `+ (=:0 format ``)'; end; with (Columns.Add('EUR') as EXGRIDLib.Column) do begin Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); FormatColumn := 'len(%0) ? ((0:=0.72*dbl(%0)) < 10 ? ''<fgcolor=808080><font ;7>'' : ''<b>'') + `EUR `+ (=:0 format ``)'; end; with Items do begin AddItem('1.23'); AddItem('2.34'); AddItem('9.94'); AddItem('11.94'); AddItem('1000'); end; HotBackColor := BackColor; HotForeColor := ForeColor; EndUpdate(); end |
881 |
How do I format a column using a currency, and another column to another currency
with AxGrid1 do begin (Columns.Add('Value') as EXGRIDLib.Column).Visible := False; with (Columns.Add('USD') as EXGRIDLib.Column) do begin Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); FormatColumn := 'len(%0) ? ((0:=dbl(%0)) < 10 ? ''<fgcolor=808080><font ;7>'' : ''<b>'') + `USD `+ (=:0 format ``)'; end; with (Columns.Add('EUR') as EXGRIDLib.Column) do begin Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); FormatColumn := 'len(%0) ? ((0:=0.72*dbl(%0)) < 10 ? ''<fgcolor=808080><font ;7>'' : ''<b>'') + `EUR `+ (=:0 format ``)'; end; with Items do begin AddItem('1.23'); AddItem('2.34'); AddItem('9.94'); AddItem('11.94'); AddItem('1000'); end; end |
880 |
How can I sort the columns to be displayed on the columns floating bar
with AxGrid1 do begin ColumnAutoResize := False; with Columns do begin (Add('City') as EXGRIDLib.Column).Visible := False; (Add('Start') as EXGRIDLib.Column).Visible := False; (Add('End') as EXGRIDLib.Column).Visible := False; end; ColumnsFloatBarVisible := EXGRIDLib.ColumnsFloatBarVisibleEnum.exColumnsFloatBarVisibleIncludeHiddenColumns; ColumnsFloatBarSortOrder := EXGRIDLib.SortOrderEnum.SortAscending; end |
879 |
How can I get the column index and the row index of the active cell
// FocusChanged event - Occurs when a new cell is focused. procedure TWinForm1.AxGrid1_FocusChanged(sender: System.Object; e: System.EventArgs); begin with AxGrid1 do begin OutputDebugString( 'Active/Focus-Column:' ); OutputDebugString( Columns.Item[TObject(FocusColumnIndex)].Caption ); with Items do begin OutputDebugString( 'Active/Focus-Row/Item:' ); OutputDebugString( CellCaption[TObject(FocusItem),TObject(AxGrid1.FocusColumnIndex)] ); end; end end; with AxGrid1 do begin BeginUpdate(); with Columns do begin (Add('C1') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.EditType; (Add('C2') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.EditType; (Add('C3') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.EditType; end; with Items do begin h := AddItem(TObject(1)); CellValue[TObject(h),TObject(1)] := TObject(2); CellValue[TObject(h),TObject(2)] := TObject(3); h := AddItem(TObject(3)); CellValue[TObject(h),TObject(1)] := TObject(1); CellValue[TObject(h),TObject(2)] := TObject(2); end; EndUpdate(); end |
878 |
How can I add a vertical padding
with AxGrid1 do begin BeginUpdate(); DrawGridLines := EXGRIDLib.GridLinesEnum.exAllLines; with (Columns.Add('Padding') as EXGRIDLib.Column) do begin Def[EXGRIDLib.DefColumnEnum.exCellHasCheckBox] := TObject(True); Def[EXGRIDLib.DefColumnEnum.exCellSingleLine] := TObject(False); Def[EXGRIDLib.DefColumnEnum.exCellPaddingLeft] := TObject(6); Def[EXGRIDLib.DefColumnEnum.exCellPaddingRight] := TObject(6); Def[EXGRIDLib.DefColumnEnum.exCellPaddingTop] := TObject(6); Def[EXGRIDLib.DefColumnEnum.exCellPaddingBottom] := TObject(6); end; with Items do begin AddItem('padding'); AddItem('padding'); end; EndUpdate(); end |
877 |
How can I set item's height individually for every item in the control and also have line breaks in the item caption
with AxGrid1 do begin BackColorAlternate := Color.FromArgb(240,240,240); with (Columns.Add('Lines') as EXGRIDLib.Column) do begin Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); Def[EXGRIDLib.DefColumnEnum.exCellSingleLine] := TObject(False); end; ItemsAllowSizing := EXGRIDLib.ItemsAllowSizingEnum.exResizeItem; with Items do begin h := AddItem('Line 1<br>Line 2'); ItemMinHeight[h] := 36; ItemHeight[h] := ItemMinHeight[h]; ItemMaxHeight[h] := ItemMinHeight[h]; h := AddItem('Line 1<br>Line 2'); ItemMinHeight[h] := 48; ItemHeight[h] := ItemMinHeight[h]; ItemMaxHeight[h] := ItemMinHeight[h]; h := AddItem('Line 1<br>Line 2'); ItemMinHeight[h] := 64; ItemHeight[h] := ItemMinHeight[h]; ItemMaxHeight[h] := ItemMinHeight[h]; end; end |
876 |
The mouse-cursor is shown over the tooltip. Is it possible somehow resolve this (method 2)
// MouseMove event - Occurs when the user moves the mouse. procedure TWinForm1.AxGrid1_MouseMoveEvent(sender: System.Object; e: AxEXGRIDLib._IGridEvents_MouseMoveEvent); begin with AxGrid1 do begin ShowToolTip('This is bit of text that''s shown when the user hovers the cell','Column',TObject(0),'+16','+16'); end end; with AxGrid1 do begin Columns.Add('Column'); with Items do begin AddItem('tooltip'); end; end |
875 |
The mouse-cursor is shown over the tooltip. Is it possible somehow resolve this (method 1)
|
874 |
How can I add a MIN or MAX field (for date)
with AxGrid1 do begin BeginUpdate(); (Columns.Add('Text') as EXGRIDLib.Column).SortType := EXGRIDLib.SortTypeEnum.SortDate; with Items do begin AddItem('1/1/2001'); AddItem('12/11/1998'); AddItem('1/20/2014'); AddItem('1/1/2013'); h := AddItem('min(all,dir,date(%0))'); SortableItem[h] := False; CellValueFormat[TObject(h),TObject(0)] := EXGRIDLib.ValueFormatEnum.exTotalField; CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.RightAlignment; FormatCell[TObject(h),TObject(0)] := '''MIN: ''+value'; h := AddItem('max(all,dir,date(%0))'); SortableItem[h] := False; CellValueFormat[TObject(h),TObject(0)] := EXGRIDLib.ValueFormatEnum.exTotalField; CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.RightAlignment; FormatCell[TObject(h),TObject(0)] := '''MAX: ''+value'; end; EndUpdate(); end |
873 |
How can I add a MIN or MAX field (for text)
with AxGrid1 do begin BeginUpdate(); (Columns.Add('Text') as EXGRIDLib.Column).SortType := EXGRIDLib.SortTypeEnum.SortString; with Items do begin AddItem('aha'); AddItem('baba'); AddItem('aaha'); AddItem('aka'); h := AddItem('min(all,dir,str(%0))'); SortableItem[h] := False; CellValueFormat[TObject(h),TObject(0)] := EXGRIDLib.ValueFormatEnum.exTotalField; CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.RightAlignment; FormatCell[TObject(h),TObject(0)] := '''MIN: ''+value'; h := AddItem('max(all,dir,str(%0))'); SortableItem[h] := False; CellValueFormat[TObject(h),TObject(0)] := EXGRIDLib.ValueFormatEnum.exTotalField; CellHAlignment[TObject(h),TObject(0)] := EXGRIDLib.AlignmentEnum.RightAlignment; FormatCell[TObject(h),TObject(0)] := '''MAX: ''+value'; end; EndUpdate(); end |
872 |
How can I change the the focus rectangle
with AxGrid1 do begin BeginUpdate(); VisualAppearance.Add(1,'gBFLBCJwBAEHhEJAAEhABeEGACAADACAxRDgMQBQKAAzQFAYbBlBaERiGQYIJhUAIIRZGMQxXAcMQvDSKQJhGDAADENAxAJCI4DBIgZQNDwZQIkCY4ZDKHIfRzNAASJI' + 'kTQPBKfYDGOLhSh6IJGRpPEIxdJMBr+fZ9QApeoYVj2J4eUCAFBxDRsZw8BiNAbkOi4Jp1f5nVJaFSxCKoSxbNqSBpGCzoJrKdI0R5JES2BAddTLBKzX7tHArLgSJ5dS' + 'rLMrwSKcRR1HSbIDyGaMUiCSqGVjWNZ5FREM46AAGbDgMILEgOZpoYDFVTZTKFCS7I6Eb40CCbCyPJQAabgWo4KAAZThNi7QAua4bTr7HqibLAexaJDOc4HVSgMLlIYE' + 'kIeg2iybAjDkfhMFuHY7mQT4xB0TBnFoUQ6i+cg2j2SIvHqVZIl8cB+BwTgPA4NRdjycg2FoHhuAMUZuHGUAwCECQUAaEYMHQHRHCGFRZEQAABO2AwRFCWQJAoGxECWT' + 'BHkGBxpg8RhYBMbJbD+TBzByfwwAwCIOCWCQiGiJgogqYh4hYIQ/k2cx9gEYQAAiRgqgsYx4mYLIOiOCMjjCTA4iScw8mMOQWEaEZkGkDgpguUIYm4SITmUCQaDuExjg' + 'kRhWhQJQ0A4ToVmWSQWFkAAljkdhiheZgZgoXIZCUWYaF2GgihmKhrg4JRJjYboVmaSIiHOHQnAkahph2ZYJmQAAxAwSQKESHwkFkKgoiAIxIHoPIimOOg2DiCgoiQJR' + 'QTYQxwn8MgMgoMoPiaYoaGCfw4A4CJNAkOpcGQBCAg=='); set_Background(EXGRIDLib.BackgroundPartEnum.exShowFocusRect,$1000000); with (Columns.Add('Check') as EXGRIDLib.Column) do begin Def[EXGRIDLib.DefColumnEnum.exCellPaddingLeft] := TObject(2); Def[EXGRIDLib.DefColumnEnum.exCellHasCheckBox] := TObject(True); end; SelForeColor := ForeColor; SelBackColor := BackColor; DefaultItemHeight := 22; ShowFocusRect := True; with Items do begin AddItem(''); AddItem(''); end; EndUpdate(); end |
871 |
Can each cell have their own dropdown lists that contain "different list item values" for each cell, not predefined for the entire column
with AxGrid1 do begin BeginUpdate(); with (Columns.Add('Column/Cell-Same') as EXGRIDLib.Column).Editor do begin EditType := EXGRIDLib.EditTypeEnum.DropDownListType; AddItem(0,'Zero',Nil); AddItem(1,'One',Nil); AddItem(2,'Two',Nil); end; with (Columns.Add('Column/Cell-Different') as EXGRIDLib.Column).Editor do begin EditType := EXGRIDLib.EditTypeEnum.EditType; end; with Items do begin AddItem(Nil); h := AddItem(TObject(0)); with CellEditor[TObject(h),TObject(1)] do begin EditType := EXGRIDLib.EditTypeEnum.DropDownListType; AddItem(3,'Three',Nil); AddItem(4,'Four',Nil); end; CellValue[TObject(h),TObject(1)] := TObject(3); AddItem(Nil); h := AddItem(TObject(0)); with CellEditor[TObject(h),TObject(1)] do begin EditType := EXGRIDLib.EditTypeEnum.CheckListType; AddItem(1,'Single',Nil); AddItem(2,'Double',Nil); end; CellValue[TObject(h),TObject(1)] := TObject(3); end; EndUpdate(); end |
870 |
How can I specify just a few fonts in a FontType editor
with AxGrid1 do begin BeginUpdate(); DefaultItemHeight := 22; DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines; with (Columns.Add('Fonts') as EXGRIDLib.Column).Editor do begin EditType := EXGRIDLib.EditTypeEnum.FontType; ClearItems(); AddItem(0,'Calibri',Nil); AddItem(1,'Arial',Nil); AddItem(2,'Rockwell',Nil); AddItem(3,'Tahoma',Nil); SortItems(TObject(True),Nil); DropDownRows := 4; end; with Items do begin AddItem('Tahoma'); end; EndUpdate(); end |
869 |
How do you embed HTML options into the anchor click string
// AnchorClick event - Occurs when an anchor element is clicked. procedure TWinForm1.AxGrid1_AnchorClick(sender: System.Object; e: AxEXGRIDLib._IGridEvents_AnchorClickEvent); begin with AxGrid1 do begin OutputDebugString( e.anchorID ); OutputDebugString( e.options ); end end; with AxGrid1 do begin BeginUpdate(); with Columns do begin (Add('Car') as EXGRIDLib.Column).Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); end; with Items do begin AddItem('<a mazda_1;options for 1>Mazda <b>1</b></a>'); AddItem('<a mazda_2;options for 2>Mazda <b>2</b></a>'); AddItem('<a mazda_3;options for 3a>Mazda <b>3.a</b></a>'); AddItem('<a mazda_3;options for 3b>Mazda <b>3.b</b></a>'); end; EndUpdate(); end |
868 |
How do I add a checkbox column (method 2)
// CellStateChanged event - Fired after cell's state has been changed. procedure TWinForm1.AxGrid1_CellStateChanged(sender: System.Object; e: AxEXGRIDLib._IGridEvents_CellStateChangedEvent); begin with AxGrid1 do begin OutputDebugString( 'CheckBox Changed:' ); OutputDebugString( Items.CellState[TObject(e.item),TObject(e.colIndex)] ); end end; with AxGrid1 do begin BeginUpdate(); (Columns.Add('Check') as EXGRIDLib.Column).Def[EXGRIDLib.DefColumnEnum.exCellHasCheckBox] := TObject(True); with Items do begin CellState[TObject(AddItem('Check 1')),TObject(0)] := 0; CellState[TObject(AddItem('Check 2')),TObject(0)] := 1; CellState[TObject(AddItem('Check 3')),TObject(0)] := 0; CellState[TObject(AddItem('Check 4')),TObject(0)] := 1; end; EndUpdate(); end |
867 |
How do I add a checkbox column (method 1)
// Change event - Occurs when the user changes the cell's content. procedure TWinForm1.AxGrid1_Change(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ChangeEvent); begin with AxGrid1 do begin OutputDebugString( 'CheckBox Changed:' ); OutputDebugString( e.newValue ); end end; with AxGrid1 do begin BeginUpdate(); with (Columns.Add('Check') as EXGRIDLib.Column) do begin with Editor do begin EditType := EXGRIDLib.EditTypeEnum.CheckValueType; Option[EXGRIDLib.EditorOptionEnum.exCheckValue2] := TObject(1); end; end; with Items do begin AddItem(TObject(0)); AddItem(TObject(1)); AddItem(TObject(0)); AddItem(TObject(1)); end; EndUpdate(); end |
866 |
How do I change the progress bar's appearance
with AxGrid1 do begin with VisualAppearance do begin Add(1,'c:\exontrol\images\normal.ebn'); Add(2,'c:\exontrol\images\pushed.ebn'); end; var_Editor := (Columns.Add('Progress') as EXGRIDLib.Column).Editor; with var_Editor do begin EditType := EXGRIDLib.EditTypeEnum.ProgressBarType; Option[EXGRIDLib.EditorOptionEnum.exProgressBarBackColor] := TObject(16777216); Option[EXGRIDLib.EditorOptionEnum.exProgressBarMarkTicker] := TObject(33554432); end; Items.AddItem(TObject(33)); end |
865 |
I have the rows with different background color, and when I select the item it takes the color of the SelBackColor, and therefore is no longer visible behind the color. Is there any option to make the item's color being visible (method 3)
with AxGrid1 do begin BeginUpdate(); VisualAppearance.Add(1,'gBFLBCJwBAEHhEJAEGg4BVEIQAAYAQGKIYBkAKBQAGaAoDDMOQwQwAAxjGKEEwsACEIrjKCRShyCYZRhGcTSBCIZBqEqSZLiEZRQCWIAzATGYBRfIUEgjBM6ExwG78eg' + 'BHp/ZpkACIJJAaRjHQdJxGKKMQB9DIhCZpeKhWgkKIJBzOEyBRC4ERBGqNGrsIgLEqWZpnWhaNpWXYTLyBN64LhuK46g53O6wLxvK6hEr2dJ/YBcIAOfghf4NQ7EMRxL' + 'C8Mw3BDvYDkOAABAIgI='); (GetOcx() as EXGRIDLib.Grid).SelBackColor := $1fffffe; ShowFocusRect := False; Columns.Add('Items'); with Items do begin ItemBackColor[AddItem('red')] := $ff; ItemBackColor[AddItem('blue')] := $ff0000; ItemBackColor[AddItem('green')] := $ff00; end; EndUpdate(); end |
864 |
I have the rows with different background color, and when I select the item it takes the color of the SelBackColor, and therefore is no longer visible behind the color. Is there any option to make the item's color being visible (method 2)
with AxGrid1 do begin BeginUpdate(); SelBackMode := EXGRIDLib.BackModeEnum.exTransparent; ShowFocusRect := False; Columns.Add('Items'); with Items do begin ItemBackColor[AddItem('red')] := $ff; ItemBackColor[AddItem('blue')] := $ff0000; ItemBackColor[AddItem('green')] := $ff00; end; EndUpdate(); end |
863 |
I have the rows with different background color, and when I select the item it takes the color of the SelBackColor, and therefore is no longer visible behind the color. Is there any option to make the item's color being visible (method 1)
with AxGrid1 do begin BeginUpdate(); SelBackColor := BackColor; SelForeColor := ForeColor; ShowFocusRect := True; Columns.Add('Items'); with Items do begin ItemBackColor[AddItem('red')] := $ff; ItemBackColor[AddItem('blue')] := $ff0000; ItemBackColor[AddItem('green')] := $ff00; end; EndUpdate(); end |
862 |
The BeforeExpandItem event is fired when clicking the drop down filter button. What we can do to prevent that
// BeforeExpandItem event - Fired before an item is about to be expanded (collapsed). procedure TWinForm1.AxGrid1_BeforeExpandItem(sender: System.Object; e: AxEXGRIDLib._IGridEvents_BeforeExpandItemEvent); begin with AxGrid1 do begin OutputDebugString( 'BeforeExpandItem' ); OutputDebugString( e.item ); Items.InsertItem(e.item,Nil,'new child'); end end; with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; with Columns do begin with (Add('Items') as EXGRIDLib.Column) do begin DisplayFilterButton := True; FilterList := EXGRIDLib.FilterListEnum.exRootItems; end; end; with Items do begin ItemHasChildren[InsertItem(Nil,Nil,'Group 1')] := True; ItemHasChildren[InsertItem(Nil,Nil,'Group 2')] := True; end; EndUpdate(); end |
861 |
How can I change the shape of the line to be shown when user drag and drop data over the control, EBN
// OLEStartDrag event - Occurs when the OLEDrag method is called. procedure TWinForm1.AxGrid1_OLEStartDrag(sender: System.Object; e: AxEXGRIDLib._IGridEvents_OLEStartDragEvent); begin // Data.SetData("data to be dragged") end; with AxGrid1 do begin OLEDropMode := EXGRIDLib.exOLEDropModeEnum.exOLEDropManual; VisualAppearance.Add(1,'C:\Program Files\Exontrol\ExList\Sample\VB\DragDrop\insert_bottom.ebn'); set_Background(EXGRIDLib.BackgroundPartEnum.exListOLEDropPosition,$1000000); Columns.Add('Default'); with Items do begin AddItem('Item 1'); AddItem('Item 2'); end; end |
860 |
How can I highlight the item from cursor when the user drag and drop data over the control
// OLEStartDrag event - Occurs when the OLEDrag method is called. procedure TWinForm1.AxGrid1_OLEStartDrag(sender: System.Object; e: AxEXGRIDLib._IGridEvents_OLEStartDragEvent); begin // Data.SetData("data to be dragged") end; with AxGrid1 do begin OLEDropMode := EXGRIDLib.exOLEDropModeEnum.exOLEDropManual; set_Background(EXGRIDLib.BackgroundPartEnum.exListOLEDropPosition,$1); Columns.Add('Default'); with Items do begin AddItem('Item 1'); AddItem('Item 2'); end; end |
859 |
Is it possible to always show the editor for all cells at all times
// AddItem event - Occurs after a new Item has been inserted to Items collection. procedure TWinForm1.AxGrid1_AddItem(sender: System.Object; e: AxEXGRIDLib._IGridEvents_AddItemEvent); begin with AxGrid1 do begin Items.CellEditorVisible[TObject(e.item),TObject(0)] := EXGRIDLib.EditorVisibleEnum.exEditorVisible; Items.CellEditorVisible[TObject(e.item),TObject(1)] := EXGRIDLib.EditorVisibleEnum.exEditorVisible; end end; // EditOpen event - Occurs when the edit operation starts. procedure TWinForm1.AxGrid1_EditOpen(sender: System.Object; e: System.EventArgs); begin with AxGrid1 do begin with Items do begin v := CellValue[TObject(FocusItem),TObject(0)]; c := CellCaption[TObject(FocusItem),TObject(0)]; end; with Columns.Item[TObject(1)].Editor do begin ClearItems(); AddItem(v,c,Nil); end; end end; with AxGrid1 do begin BeginUpdate(); with (Columns.Add('DropDownList') as EXGRIDLib.Column) do begin with Editor do begin EditType := EXGRIDLib.EditTypeEnum.DropDownListType; AddItem(1,'First',Nil); AddItem(2,'Second',Nil); AddItem(3,'Third',Nil); end; end; DrawGridLines := EXGRIDLib.GridLinesEnum.exAllLines; (Columns.Add('DropDownList-Related') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.DropDownListType; with Items do begin CellValue[TObject(AddItem(TObject(1))),TObject(1)] := TObject(-1); CellValue[TObject(AddItem(TObject(2))),TObject(1)] := TObject(-1); CellValue[TObject(AddItem(TObject(3))),TObject(1)] := TObject(-1); LockedItemCount[EXGRIDLib.VAlignmentEnum.exBottom] := 1; h := LockedItem[EXGRIDLib.VAlignmentEnum.exBottom,0]; ItemDivider[h] := 0; ItemDividerLineAlignment[h] := EXGRIDLib.DividerAlignmentEnum.DividerTop; CellEditorVisible[TObject(h),TObject(0)] := EXGRIDLib.EditorVisibleEnum.exEditorHidden; CellSingleLine[TObject(h),TObject(0)] := EXGRIDLib.CellSingleLineEnum.exCaptionWordWrap; CellValueFormat[TObject(h),TObject(0)] := EXGRIDLib.ValueFormatEnum.exHTML; CellValue[TObject(h),TObject(0)] := 'The drop down editor in the second column is filled during the <b>EditOpen event</b>, and the values are based on the selection ' + 'on the first column.'; end; EndUpdate(); end |
858 |
How do I set a computated cell individually
with AxGrid1 do begin BeginUpdate(); Columns.Add('Number'); Columns.Add('Format'); with Items do begin h := AddItem('1.23'); CellValueFormat[TObject(h),TObject(1)] := Integer(EXGRIDLib.ValueFormatEnum.exComputedField) Or Integer(EXGRIDLib.ValueFormatEnum.exHTML); CellValue[TObject(h),TObject(1)] := '2 * %0 + ` <font ;6><fgcolor=808080>(2 * Number)`'; h := AddItem('1.23'); CellValueFormat[TObject(h),TObject(1)] := Integer(EXGRIDLib.ValueFormatEnum.exComputedField) Or Integer(EXGRIDLib.ValueFormatEnum.exHTML); CellValue[TObject(h),TObject(1)] := '3 * %0 + ` <font ;6><fgcolor=808080>(3 * Number)`'; h := AddItem('1.23'); CellValueFormat[TObject(h),TObject(1)] := Integer(EXGRIDLib.ValueFormatEnum.exComputedField) Or Integer(EXGRIDLib.ValueFormatEnum.exHTML); CellValue[TObject(h),TObject(1)] := 'currency(%0) + ` <font ;6><fgcolor=808080>( Currency(Number) )`'; end; EndUpdate(); end |
857 |
Is it possible to assign a different editor for some cells
with AxGrid1 do begin with (Columns.Add('Column - DropDownList') as EXGRIDLib.Column).Editor do begin EditType := EXGRIDLib.EditTypeEnum.DropDownListType; AddItem(1,'First item',Nil); AddItem(2,'Second item',Nil); AddItem(3,'Third item',Nil); end; (Columns.Add('Cell - DropDownList') as EXGRIDLib.Column).Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); with Items do begin h := AddItem(TObject(1)); with CellEditor[TObject(h),TObject(1)] do begin EditType := EXGRIDLib.EditTypeEnum.DropDownListType; AddItem(1,'<b>First</b> item',Nil); AddItem(2,'<b>Second</b> item',Nil); AddItem(3,'<b>Third</b> item',Nil); AddItem(4,'<b>Forth</b> item',Nil); end; CellValue[TObject(h),TObject(1)] := TObject(2); h := AddItem(TObject(2)); with CellEditor[TObject(h),TObject(1)] do begin EditType := EXGRIDLib.EditTypeEnum.DropDownListType; AddItem(1,'<b>Aka First</b> item',Nil); AddItem(2,'<b>Aka Second</b> item',Nil); AddItem(3,'<b>Aka Third</b> item',Nil); AddItem(4,'<b>Aka Forth</b> item',Nil); end; CellValue[TObject(h),TObject(1)] := TObject(2); end; end |
856 |
Is it possible to define the keys of the drop down values to be strings rather than numeric values
// Change event - Occurs when the user changes the cell's content. procedure TWinForm1.AxGrid1_Change(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ChangeEvent); begin with AxGrid1 do begin OutputDebugString( 'NewValue is' ); OutputDebugString( e.newValue ); end end; with AxGrid1 do begin with (Columns.Add('DropDownList-String') as EXGRIDLib.Column).Editor do begin EditType := EXGRIDLib.EditTypeEnum.DropDownListType; AddItem(1,'NYC|New York City',Nil); AddItem(2,'CJN|Cluj Napoca',Nil); end; with (Columns.Add('DropDownList-Numeric') as EXGRIDLib.Column).Editor do begin EditType := EXGRIDLib.EditTypeEnum.DropDownListType; AddItem(1,'New York City',Nil); AddItem(2,'Cluj Napoca',Nil); end; with Items do begin CellValue[TObject(AddItem('NYC')),TObject(1)] := TObject(2); end; end |
855 |
The Change event gets me the today date. How can I find what user typed
// Change event - Occurs when the user changes the cell's content. procedure TWinForm1.AxGrid1_Change(sender: System.Object; e: AxEXGRIDLib._IGridEvents_ChangeEvent); begin with AxGrid1 do begin OutputDebugString( 'NewValue:' ); OutputDebugString( e.newValue ); OutputDebugString( 'EditingValue:' ); OutputDebugString( EditingText ); end end; with AxGrid1 do begin BeginUpdate(); (Columns.Add('Edit') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.DateType; Items.AddItem('1/1/2001'); EndUpdate(); end |
854 |
I have an edit field, when going to edit mode, the rightmost part is shown. Is it possible to show the left part instead
with AxGrid1 do begin BeginUpdate(); with (Columns.Add('Edit') as EXGRIDLib.Column) do begin Width := 64; AllowSizing := False; with Editor do begin EditType := EXGRIDLib.EditTypeEnum.MaskType; Mask := ';;;rich'; end; end; Columns.Add('Empty'); with Items do begin AddItem('This is a bit ot long text'); AddItem(''); end; EndUpdate(); end |
853 |
I have a drop down field, the control shows the rightmost part of the selected caption. Is it possible to show the left part
with AxGrid1 do begin BeginUpdate(); with (Columns.Add('DropDown') as EXGRIDLib.Column) do begin Width := 64; AllowSizing := False; with Editor do begin DropDownAlignment := EXGRIDLib.AlignmentEnum($20); EditType := EXGRIDLib.EditTypeEnum.DropDownType; AddItem(1,'First item. This is a bit ot long text',Nil); AddItem(2,'Second item. This is a bit ot long text',Nil); AddItem(3,'Third item. This is a bit ot long text',Nil); Mask := ';;;rich'; end; end; with (Columns.Add('PickEdit') as EXGRIDLib.Column) do begin Width := 64; AllowSizing := False; with Editor do begin DropDownAlignment := EXGRIDLib.AlignmentEnum($20); EditType := EXGRIDLib.EditTypeEnum.PickEditType; AddItem(1,'First item. This is a bit ot long text',Nil); AddItem(2,'Second item. This is a bit ot long text',Nil); AddItem(3,'Third item. This is a bit ot long text',Nil); Mask := ';;;rich'; end; end; Columns.Add('Empty'); with Items do begin CellValue[TObject(AddItem('First item. This is a bit ot long text')),TObject(1)] := 'Second item. This is a bit ot long text'; h := AddItem('First item. This is a bit ot long text'); with CellEditor[TObject(h),TObject(0)] do begin DropDownAlignment := EXGRIDLib.AlignmentEnum($20); EditType := EXGRIDLib.EditTypeEnum.DropDownType; AddItem(1,'First item. This is a bit ot long text',Nil); AddItem(2,'Second item. This is a bit ot long text',Nil); AddItem(3,'Third item. This is a bit ot long text',Nil); end; CellValue[TObject(h),TObject(1)] := 'Second item. This is a bit ot long text'; with CellEditor[TObject(h),TObject(1)] do begin DropDownAlignment := EXGRIDLib.AlignmentEnum($20); EditType := EXGRIDLib.EditTypeEnum.PickEditType; AddItem(1,'First item. This is a bit ot long text',Nil); AddItem(2,'Second item. This is a bit ot long text',Nil); AddItem(3,'Third item. This is a bit ot long text',Nil); end; end; EndUpdate(); end |
852 |
Is there a property for the back color of the dropdown field
with AxGrid1 do begin BeginUpdate(); with (Columns.Add('Date') as EXGRIDLib.Column).Editor do begin EditType := EXGRIDLib.EditTypeEnum.DateType; Option[EXGRIDLib.EditorOptionEnum.exDropDownBackColor] := TObject(15790320); Option[EXGRIDLib.EditorOptionEnum.exDropDownForeColor] := TObject(65793); end; Items.AddItem('1/1/2001'); EndUpdate(); end |
851 |
Is it possible to change a back color of the field/cell when it takes a focus
// EditClose event - Occurs when the edit operation ends. procedure TWinForm1.AxGrid1_EditCloseEvent(sender: System.Object; e: System.EventArgs); begin with AxGrid1 do begin with Items do begin ClearCellBackColor(TObject(FocusItem),TObject(AxGrid1.FocusColumnIndex)); end; end end; // EditOpen event - Occurs when the edit operation starts. procedure TWinForm1.AxGrid1_EditOpen(sender: System.Object; e: System.EventArgs); begin with AxGrid1 do begin with Items do begin CellBackColor[TObject(FocusItem),TObject(AxGrid1.FocusColumnIndex)] := $ff; end; with Items do begin CellValue[TObject(FocusItem),TObject(AxGrid1.FocusColumnIndex)] := AxGrid1.Items.CellValue[TObject(AxGrid1.Items.FocusItem),TObject(AxGrid1.FocusColumnIndex)]; end; end end; with AxGrid1 do begin FullRowSelect := EXGRIDLib.CellSelectEnum.exColumnSel; (Columns.Add('C1') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.EditType; (Columns.Add('C2') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.EditType; with Items do begin CellValue[TObject(AddItem('v1')),TObject(1)] := 'v2'; CellValue[TObject(AddItem('v3')),TObject(1)] := 'v4'; end; end |
850 |
How can I display the current date mask, but still allow empty values
with AxGrid1 do begin BeginUpdate(); CauseValidateValue := EXGRIDLib.ValidateValueType.exValidateCell; FullRowSelect := EXGRIDLib.CellSelectEnum.exColumnSel; DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines; with (Columns.Add('Date') as EXGRIDLib.Column).Editor do begin EditType := EXGRIDLib.EditTypeEnum.DateType; Mask := '!99/99/9999;1;;empty=1,validateas=1,invalid=Invalid date\, for the input mask <br><b>''<%mask%>''</b>!,warning=Invalid character!,' + 'select=4,overtype'; end; with Items do begin AddItem(Nil); AddItem('1/1/2001'); AddItem(Nil); end; EndUpdate(); end |
849 |
How can I align the days in a DateType editor
with AxGrid1 do begin Columns.Add('DropDown'); with Items do begin with CellEditor[TObject(AddItem('1/1/2001')),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.DateType; DropDownAlignment := EXGRIDLib.AlignmentEnum.RightAlignment; end; with CellEditor[TObject(AddItem('1/1/2001')),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.DateType; DropDownAlignment := EXGRIDLib.AlignmentEnum.CenterAlignment; end; with CellEditor[TObject(AddItem('1/1/2001')),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.DateType; DropDownAlignment := EXGRIDLib.AlignmentEnum.LeftAlignment; end; with CellEditor[TObject(AddItem('1/1/2001')),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.DateType; DropDownAlignment := EXGRIDLib.AlignmentEnum($20); end; with CellEditor[TObject(AddItem('1/1/2001')),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.DateType; DropDownAlignment := EXGRIDLib.AlignmentEnum($20 Or Integer(EXGRIDLib.AlignmentEnum.CenterAlignment)); end; with CellEditor[TObject(AddItem('1/1/2001')),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.DateType; DropDownAlignment := EXGRIDLib.AlignmentEnum($20 Or Integer(EXGRIDLib.AlignmentEnum.RightAlignment)); end; end; end |
848 |
How can I align the drop down portion rather the inside captions
with AxGrid1 do begin (Columns.Add('DropDown') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.DateType; with Items do begin with CellEditor[TObject(AddItem('1/1/2001')),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.DateType; DropDownAlignment := EXGRIDLib.AlignmentEnum($20); end; with CellEditor[TObject(AddItem('1/1/2001')),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.DateType; DropDownAlignment := EXGRIDLib.AlignmentEnum($10); end; AddItem('1/1/2001'); end; end |
847 |
Is it possible to show a message that the field is empty
with AxGrid1 do begin DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines; FullRowSelect := EXGRIDLib.CellSelectEnum.exColumnSel; with (Columns.Add('Float') as EXGRIDLib.Column) do begin with Editor do begin EditType := EXGRIDLib.EditTypeEnum.MaskType; Mask := ';;;float,digits=0,grouping=,invalid=empty,warning=invalid character'; end; end; Items.AddItem(TObject(192278)); Items.AddItem(TObject(1000)); end |
846 |
How can I mask a date
with AxGrid1 do begin BeginUpdate(); CauseValidateValue := EXGRIDLib.ValidateValueType.exValidateCell; FullRowSelect := EXGRIDLib.CellSelectEnum.exColumnSel; DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines; Columns.Add('Date'); Columns.Add('Mask'); with Items do begin h := AddItem('1/1/2001'); with CellEditor[TObject(h),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.DateType; Mask := '{1,12}/{1,31}/{1950,2050};1;;select=1,warning=Invalid character!,invalid=Invalid date\, for the input mask <br><b>''<%mask%>''</b>' + '!,validateas=1'; end; CellValue[TObject(h),TObject(1)] := TObject(CellEditor[TObject(h),TObject(0)].Mask); h := AddItem('1/1/2001'); with CellEditor[TObject(h),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.DateType; Mask := '!99/99/9999;1;;empty,validateas=1,invalid=Invalid date\, for the input mask <br><b>''<%mask%>''</b>!,warning=Invalid character!,se' + 'lect=4,overtype'; end; CellValue[TObject(h),TObject(1)] := TObject(CellEditor[TObject(h),TObject(0)].Mask); h := AddItem('1/1/2001'); with CellEditor[TObject(h),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.DateType; Mask := '!99/99/9999;;;empty,validateas=1,invalid=Invalid date\, for the input mask <br><b>''<%mask%>''</b>!,warning=Invalid character!,sel' + 'ect=4,overtype'; end; CellValue[TObject(h),TObject(1)] := TObject(CellEditor[TObject(h),TObject(0)].Mask); h := AddItem('1/1/2001'); with CellEditor[TObject(h),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.DateType; Mask := '!99/99/9999;; ;select=4,overtype,empty,warning=Invalid character!,invalid=Invalid date\, for the input mask <br><b>''<%mask%>''</b' + '>!,validateas=1'; end; CellValue[TObject(h),TObject(1)] := TObject(CellEditor[TObject(h),TObject(0)].Mask); h := AddItem('1/1/2001'); with CellEditor[TObject(h),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.DateType; Mask := '![0-9 ][0-9 ]/[0-9 ][0-9 ]/[0-9 ][0-9 ][0-9 ][0-9 ];1;;empty,validateas=1,invalid=Invalid date\, for the input mask <br><b>''<%ma' + 'sk%>''</b>!,warning=Invalid character!,select=4,leading= '; end; CellValue[TObject(h),TObject(1)] := TObject(CellEditor[TObject(h),TObject(0)].Mask); h := AddItem('1/1/2001'); FormatCell[TObject(h),TObject(0)] := 'len(value) ? shortdateF(value) : ``'; with CellEditor[TObject(h),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.DateType; Mask := '!99/99/9999;1;;empty,validateas=1,invalid=Invalid date\, for the input mask <br><b>''<%mask%>''</b>!,warning=Invalid character!,se' + 'lect=4,overtype,leading'; end; CellValue[TObject(h),TObject(1)] := TObject(CellEditor[TObject(h),TObject(0)].Mask); h := AddItem('1/1/2001'); FormatCell[TObject(h),TObject(0)] := 'len(value) ? shortdateF(value) : ``'; with CellEditor[TObject(h),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.DateType; Mask := '!00/00/0000;1;;empty,validateas=1,invalid=Invalid date\, for the input mask <br><b>''<%mask%>''</b>!,warning=Invalid character!,se' + 'lect=4,overtype,leading'; end; CellValue[TObject(h),TObject(1)] := TObject(CellEditor[TObject(h),TObject(0)].Mask); h := AddItem('1/1/2001'); FormatCell[TObject(h),TObject(0)] := 'len(value) ? shortdateF(value) : ``'; with CellEditor[TObject(h),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.DateType; Mask := '!00/00/0000;;0;empty,validateas=1,invalid=Invalid date\, for the input mask <br><b>''<%mask%>''</b>!,warning=Invalid character!,se' + 'lect=4,overtype'; end; CellValue[TObject(h),TObject(1)] := TObject(CellEditor[TObject(h),TObject(0)].Mask); h := AddItem('1/1/2001'); FormatCell[TObject(h),TObject(0)] := 'len(value) ? shortdateF(value) : ``'; with CellEditor[TObject(h),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.DateType; Mask := '!00/00/0000;;;empty,validateas=1,invalid=Invalid date\, for the input mask <br><b>''<%mask%>''</b>!,warning=Invalid character!,sel' + 'ect=1,overtype'; end; CellValue[TObject(h),TObject(1)] := TObject(CellEditor[TObject(h),TObject(0)].Mask); end; EndUpdate(); end |
845 |
How can I display and edit an integer number to show grouping digits too ( no decimals)
with AxGrid1 do begin with (Columns.Add('Float') as EXGRIDLib.Column) do begin FormatColumn := 'value format `0`'; with Editor do begin EditType := EXGRIDLib.EditTypeEnum.MaskType; Mask := ';;;float,digits=0'; end; end; Items.AddItem(TObject(192278)); end |
844 |
How can I display and edit a float number to show grouping digits too
with AxGrid1 do begin with (Columns.Add('Float') as EXGRIDLib.Column) do begin FormatColumn := 'value format ``'; with Editor do begin EditType := EXGRIDLib.EditTypeEnum.MaskType; Mask := ';;;float'; end; end; Items.AddItem(TObject(192278)); end |
843 |
How can I mask a phone number
with AxGrid1 do begin CauseValidateValue := EXGRIDLib.ValidateValueType.exValidateCell; DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines; FullRowSelect := EXGRIDLib.CellSelectEnum.exColumnSel; (Columns.Add('Phone') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.MaskType; with Items do begin h := AddItem(Nil); with CellEditor[TObject(h),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.MaskType; Mask := '!(999) 000 0000;1;;select=1,empty,overtype,warning=invalid characer,invalid=The value you entered isn''t appropriate for the inpu' + 't mask <b>''<%mask%>''</b> specified for this field.'; end; h := AddItem('0123'); with CellEditor[TObject(h),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.MaskType; Mask := '!(999) 000 0000;2;;select=4'; end; h := AddItem('0123'); with CellEditor[TObject(h),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.MaskType; Mask := '`Phone: `!(999) 000-0000'; end; h := AddItem('(074) 876-1222'); with CellEditor[TObject(h),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.MaskType; Mask := '!(999) 000-0000;0'; end; end; end |
842 |
Is it possible to display the ColorType fields using RGB format
with AxGrid1 do begin (Columns.Add('Color') as EXGRIDLib.Column).Editor.EditType := EXGRIDLib.EditTypeEnum.ColorType; with Items do begin AddItem(TObject(255)); h := AddItem(TObject(255)); with CellEditor[TObject(h),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.ColorType; Mask := '`RGB(`{0,255}\,{0,255}\,{0,255}`)`;;0'; end; h := AddItem(TObject(255)); with CellEditor[TObject(h),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.ColorType; Mask := '`&H`XXXXXXXX`&`;;0;overtype,insertype,warning=Wrong!'; end; h := AddItem(TObject(255)); with CellEditor[TObject(h),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.ColorType; Mask := '`0x`XX `0x`XX `0x`XX;;0;overtype,insertype,warning=Wrong!'; end; h := AddItem(TObject(255)); with CellEditor[TObject(h),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.ColorType; Mask := 'R{0,255} G{0,255} B{0,255};;0;overtype,insertype,warning=Wrong!'; end; h := AddItem(TObject(255)); with CellEditor[TObject(h),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.ColorType; Mask := '`(hexa) RGB 0x`XXXXXX;;0;overtype,insertype,warning=Wrong!'; end; h := AddItem(TObject(255)); with CellEditor[TObject(h),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.ColorType; Mask := '`(decimal) Red: `{0,255}` Green: `{0,255}` Blue: `{0,255};;0;overtype,insertype,warning=Wrong!'; end; h := AddItem(TObject(255)); with CellEditor[TObject(h),TObject(0)] do begin EditType := EXGRIDLib.EditTypeEnum.ColorType; Mask := '`(combine) Red: `{0,255}` Green: 0x`XX` Blue: `{0,255};;0;overtype,insertype,warning=Wrong!'; end; end; end |
841 |
How can I add the ExComboBox as an user editor
// UserEditorClose event - Fired the user editor is about to be opened. procedure TWinForm1.AxGrid1_UserEditorClose(sender: System.Object; e: AxEXGRIDLib._IGridEvents_UserEditorCloseEvent); begin // Items.CellValue(Item,ColIndex) = Object.Value end; // UserEditorOleEvent event - Occurs when an user editor fires an event. procedure TWinForm1.AxGrid1_UserEditorOleEvent(sender: System.Object; e: AxEXGRIDLib._IGridEvents_UserEditorOleEventEvent); begin with AxGrid1 do begin OutputDebugString( e.ev ); end end; // UserEditorOpen event - Occurs when an user editor is about to be opened. procedure TWinForm1.AxGrid1_UserEditorOpen(sender: System.Object; e: AxEXGRIDLib._IGridEvents_UserEditorOpenEvent); begin // Object.Value = Me.Items.CellValue(Item,ColIndex) end; with AxGrid1 do begin BeginUpdate(); with (Columns.Add('Exontrol.ComboBox') as EXGRIDLib.Column).Editor do begin EditType := EXGRIDLib.EditTypeEnum.UserEditorType; UserEditor('Exontrol.ComboBox',''); with UserEditorObject do begin end; end; DrawGridLines := EXGRIDLib.GridLinesEnum.exRowLines; DefaultItemHeight := 21; with Items do begin CellEditorVisible[TObject(AddItem(TObject(10248))),TObject(0)] := EXGRIDLib.EditorVisibleEnum.exEditorVisible; CellEditorVisible[TObject(AddItem(TObject(10249))),TObject(0)] := EXGRIDLib.EditorVisibleEnum.exEditorVisible; CellEditorVisible[TObject(AddItem(TObject(10250))),TObject(0)] := EXGRIDLib.EditorVisibleEnum.exEditorVisible; end; EndUpdate(); end |
840 |
How can I add a header row
with AxGrid1 do begin ShowLockedItems := True; DrawGridLines := EXGRIDLib.GridLinesEnum.exVLines; Columns.Add('C1'); Columns.Add('C2'); with Items do begin LockedItemCount[EXGRIDLib.VAlignmentEnum.exTop] := 1; h := LockedItem[EXGRIDLib.VAlignmentEnum.exTop,0]; ItemBackColor[h] := $808080; ItemForeColor[h] := $ffffff; CellValue[TObject(h),TObject(0)] := 'footer c1'; CellValue[TObject(h),TObject(1)] := 'footer c2'; CellValue[TObject(AddItem('cell')),TObject(1)] := 'cell'; end; end |
839 |
How can I add a footer row
with AxGrid1 do begin ShowLockedItems := True; DrawGridLines := EXGRIDLib.GridLinesEnum.exVLines; Columns.Add('C1'); Columns.Add('C2'); with Items do begin LockedItemCount[EXGRIDLib.VAlignmentEnum.exBottom] := 1; h := LockedItem[EXGRIDLib.VAlignmentEnum.exBottom,0]; ItemBackColor[h] := $808080; ItemForeColor[h] := $ffffff; CellValue[TObject(h),TObject(0)] := 'footer c1'; CellValue[TObject(h),TObject(1)] := 'footer c2'; CellValue[TObject(AddItem('cell')),TObject(1)] := 'cell'; end; end |
838 |
How can I programmatically add more columns to the sort bar and other to be sorted, but not included in the sort bar
|
837 |
How can I fix a column, while other sizable and fill the control's client
with AxGrid1 do begin ColumnAutoResize := True; Columns.Add('Sizable'); with (Columns.Add('F') as EXGRIDLib.Column) do begin AllowSizing := False; Width := 16; end; end |
836 |
Is it possible to use empty values on a PickEditType editor (method 2)
with AxGrid1 do begin with (Columns.Add('DropDown') as EXGRIDLib.Column).Editor do begin EditType := EXGRIDLib.EditTypeEnum.PickEditType; AddItem(0,'',Nil); AddItem(1,'The first item',Nil); AddItem(2,'The second item',Nil); AddItem(3,'The third item',Nil); end; with Items do begin AddItem('The first item'); AddItem(''); AddItem('The third item'); end; end |
835 |
Is it possible to use empty values on a PickEditType editor (method 1)
with AxGrid1 do begin with (Columns.Add('DropDown') as EXGRIDLib.Column).Editor do begin EditType := EXGRIDLib.EditTypeEnum.PickEditType; Option[EXGRIDLib.EditorOptionEnum.exPickAllowEmpty] := TObject(True); AddItem(1,'The first item',Nil); AddItem(2,'The second item',Nil); AddItem(3,'The third item',Nil); end; with Items do begin AddItem('The first item'); AddItem(''); AddItem('The third item'); end; end |
834 |
How can I specify an unselectable cell
with AxGrid1 do begin BeginUpdate(); with Columns do begin Add('C1'); Add('C2'); Add('C3'); end; with Items do begin h := AddItem('unselectable item'); CellValue[TObject(h),TObject(1)] := 'unselectable item'; CellValue[TObject(h),TObject(2)] := 'unselectable item'; SelectableItem[h] := False; h := AddItem('selectable cell'); CellValue[TObject(h),TObject(1)] := 'unselectable cell'; CellEnabled[TObject(h),TObject(1)] := False; CellForeColor[TObject(h),TObject(1)] := $0; CellValue[TObject(h),TObject(2)] := 'disabled cell'; CellEnabled[TObject(h),TObject(2)] := False; h := AddItem('disabled item'); CellValue[TObject(h),TObject(1)] := 'disabled item'; CellValue[TObject(h),TObject(2)] := 'disabled item'; EnableItem[h] := False; SelectableItem[h] := False; end; EndUpdate(); end |
833 |
Is it possible to edit a float number without using of e/E/d/D (exponent) and +/- (signs) characters
with AxGrid1 do begin with (Columns.Add('Edit') as EXGRIDLib.Column).Editor do begin EditType := EXGRIDLib.EditTypeEnum.EditType; Numeric := Integer(EXGRIDLib.NumericEnum.exDisableSigns) Or Integer(EXGRIDLib.NumericEnum.exFloatInteger); end; Items.AddItem(TObject(1.22)); end |
832 |
How can I edit a float number with no using of e/E/d/D and + character
with AxGrid1 do begin with (Columns.Add('Edit') as EXGRIDLib.Column).Editor do begin EditType := EXGRIDLib.EditTypeEnum.EditType; Numeric := Integer(EXGRIDLib.NumericEnum.exDisablePlus) Or Integer(EXGRIDLib.NumericEnum.exFloatInteger); end; Items.AddItem(TObject(1.22)); end |
831 |
Is it possible to edit a float number with no using of e/E/d/D (exponent) characters
with AxGrid1 do begin with (Columns.Add('Edit') as EXGRIDLib.Column).Editor do begin EditType := EXGRIDLib.EditTypeEnum.EditType; Numeric := EXGRIDLib.NumericEnum.exFloatInteger; end; Items.AddItem(TObject(1.22)); end |
830 |
How can I edit an integer with no using of +/- signs
with AxGrid1 do begin with (Columns.Add('Edit') as EXGRIDLib.Column).Editor do begin EditType := EXGRIDLib.EditTypeEnum.EditType; Numeric := EXGRIDLib.NumericEnum($fc Or Integer(EXGRIDLib.NumericEnum.exDisableSigns) Or Integer(EXGRIDLib.NumericEnum.exFloatInteger) Or Integer(EXGRIDLib.NumericEnum.exFloat)); end; Items.AddItem(TObject(1)); end |
829 |
When I'm trying to show string with "line break" character (vbCrLF) in a textbox, it shows 2 squares. Is there any way to hide these squares
with AxGrid1 do begin with Columns do begin Add('Value'); with (Add('CellSingleLine = False') as EXGRIDLib.Column) do begin ComputedField := '%0'; Def[EXGRIDLib.DefColumnEnum.exCellSingleLine] := TObject(False); end; with (Add('FormatColumn/replace CRLF') as EXGRIDLib.Column) do begin ComputedField := '%0'; FormatColumn := 'value replace `\r\n` with ``'; end; with (Add('FormatColumn/replace TAB,CRLF') as EXGRIDLib.Column) do begin ComputedField := '%0'; FormatColumn := '(value replace `\t` with ``) replace `\r\n` with ``'; end; end; with Items do begin AddItem('a\ta\r\nb\tb'); end; end |
828 |
Is there any way to "unselect" radio group
// DblClick event - Occurs when the user dblclk the left mouse button over an object. procedure TWinForm1.AxGrid1_DblClick(sender: System.Object; e: AxEXGRIDLib._IGridEvents_DblClickEvent); begin with AxGrid1 do begin with Items do begin h := CellChecked[1234]; CellHasCheckBox[TObject(0),TObject(h)] := True; CellState[TObject(0),TObject(h)] := 0; CellHasCheckBox[TObject(0),TObject(h)] := False; end; end end; // SelectionChanged event - Fired after a new item has been selected. procedure TWinForm1.AxGrid1_SelectionChanged(sender: System.Object; e: System.EventArgs); begin with AxGrid1 do begin with Items do begin CellState[TObject(FocusItem),TObject(0)] := 1; end; end end; with AxGrid1 do begin MarkSearchColumn := False; SelBackColor := Color.FromArgb(255,255,128); SelForeColor := Color.FromArgb(0,0,0); Columns.Add('Default'); with Items do begin h := AddItem('Radio 1'); CellHasRadioButton[TObject(h),TObject(0)] := True; CellRadioGroup[TObject(h),TObject(0)] := 1234; h := AddItem('Radio 2'); CellHasRadioButton[TObject(h),TObject(0)] := True; CellRadioGroup[TObject(h),TObject(0)] := 1234; CellState[TObject(h),TObject(0)] := 1; h := AddItem('Radio 3'); CellHasRadioButton[TObject(h),TObject(0)] := True; CellRadioGroup[TObject(h),TObject(0)] := 1234; end; end |
827 |
The Column.Alignment property does not seem to work for cells with images in them. What can be done
with AxGrid1 do begin BeginUpdate(); Images('gBJJgBAIDAAGAAEAAQhYAf8Pf4hh0QihCJo2AEZjQAjEZFEaIEaEEaAIAkcbk0olUrlktl0vmExmUzmk1m03nE5nU7nk9n0/oFBoVDolFo1HpFJpVLplNp1PqFRqVTql' + 'Vq1XrFZrVbrldr1fsFhsVjslls1ntFptVrtltt1vuFxuVzul1u13vF5vV7vl9v1/wGBwWDwmFw2HxGJxWLxmNx0xiFdyOTh8Tf9ZymXx+QytcyNgz8r0OblWjyWds+m0' + 'ka1Vf1ta1+r1mos2xrG2xeZ0+a0W0qOx3GO4NV3WeyvD2XJ5XL5nN51aiw+lfSj0gkUkAEllHanHI5j/cHg8EZf7w8vl8j4f/qfEZeB09/vjLAB30+kZQAP/P5/H6/yN' + 'AOAEAwCjMBwFAEDwJBMDwLBYAP2/8Hv8/gAGAD8LQs9w/nhDY/oygIA='); TreeColumnIndex := -1; DrawGridLines := EXGRIDLib.GridLinesEnum.exAllLines; HeaderHeight := 24; DefaultItemHeight := 24; with (Columns.Add('Image') as EXGRIDLib.Column) do begin AllowSizing := False; Width := 32; HTMLCaption := '<img>1</img>'; HeaderAlignment := EXGRIDLib.AlignmentEnum.CenterAlignment; Alignment := EXGRIDLib.AlignmentEnum.CenterAlignment; Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); end; Columns.Add('Rest'); with Items do begin AddItem('<img>1</img>'); AddItem('<img>2</img>'); AddItem('<img>3</img>'); end; EndUpdate(); end |
826 |
Can I change the format of date to be shown in the control
with AxGrid1 do begin with Columns do begin Add('Default'); with (Add('Format.1') as EXGRIDLib.Column) do begin ComputedField := '%0'; FormatColumn := 'dateF(value) replace `/` with `-`'; end; with (Add('Format.2') as EXGRIDLib.Column) do begin ComputedField := '%0'; Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); FormatColumn := '`<b>`+ shortdate(value) + `</b> ` + timeF(value)'; end; with (Add('Format.3') as EXGRIDLib.Column) do begin ComputedField := '%0'; Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); FormatColumn := '( dateF(value) replace `/` with `-` ) + ` <b>`+ ( weekday(value) case ( 0 : `Su`; 1 : `Mo`; 2 : `Tu`; 3 : `We`; 4 : `Th`; 5 : `F' + 'r`; 6 : `Sa`) )'; end; end; with Items do begin AddItem('1/1/2001 10:00:00 AM'); AddItem('1/2/2001 10:00:00 AM'); end; end |
825 |
How do I arrange my columns on multiple levels
with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := False; DrawGridLines := EXGRIDLib.GridLinesEnum.exAllLines; with Columns do begin with (Add('C0') as EXGRIDLib.Column) do begin ExpandColumns := '1,2'; DisplayExpandButton := False; end; Add('C1'); Add('C2'); Add('C3'); with (Add('C4') as EXGRIDLib.Column) do begin ExpandColumns := '5,6'; DisplayExpandButton := False; end; Add('C5'); with (Add('C6') as EXGRIDLib.Column) do begin ExpandColumns := '6,7'; DisplayExpandButton := False; end; Add('C7'); end; EndUpdate(); end |
824 |
Does your control support expandable header or columns, so I can arrange it on multiple levels
with AxGrid1 do begin BeginUpdate(); DrawGridLines := EXGRIDLib.GridLinesEnum.exAllLines; BackColorLevelHeader := Color.FromArgb(240,240,240); with Columns do begin with (Add('Photo') as EXGRIDLib.Column) do begin AllowSizing := False; Width := 32; end; Add('Personal Info'); Add('Title'); Add('Name'); Add('First'); Add('Last'); Add('Address'); Item['Personal Info'].ExpandColumns := '2,3'; with Item['Name'] do begin ExpandColumns := '4,5'; Expanded := False; end; end; EndUpdate(); end |
823 |
How can I use the MinWidthAutoResize/MaxWidthAutoResize
with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := False; rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset); with rs do begin Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil); end; DataSource := (rs as ADODB.Recordset); with Columns.Item[TObject(0)] do begin MaxWidthAutoResize := 32; WidthAutoResize := True; end; EndUpdate(); end |
822 |
Does your control support subscript or superscript, in HTML captions
with AxGrid1 do begin ColumnAutoResize := False; HeaderHeight := 28; DefaultItemHeight := 24; with Columns do begin with (Add('Column 1') as EXGRIDLib.Column) do begin HTMLCaption := 'Column <b><off 2><font ;6>1'; Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); end; with (Add('Column 2') as EXGRIDLib.Column) do begin HTMLCaption := 'Column <b><off 2><font ;6>2'; Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); end; with (Add('Column 3') as EXGRIDLib.Column) do begin HTMLCaption := 'Column <b><off 2><font ;6>3'; Def[EXGRIDLib.DefColumnEnum.exCellValueFormat] := TObject(1); end; end; with Items do begin h := AddItem('Item <font ;6><off 4>1'); CellValue[TObject(h),TObject(1)] := 'Item <font ;6><off -6>2'; CellValue[TObject(h),TObject(2)] := 'Item <b><font ;6><off -6>2<off 4>3<off 4>1'; end; end |
821 |
How can I specify the splited cell's background color
with AxGrid1 do begin MarkSearchColumn := False; TreeColumnIndex := -1; (Columns.Add('1') as EXGRIDLib.Column).Def[EXGRIDLib.DefColumnEnum.exCellBackColor] := TObject(255); with (Columns.Add('2') as EXGRIDLib.Column) do begin Width := 32; AllowSizing := False; end; with Items do begin h := AddItem('The Item''s background color inherits the Column.Def(exCellBackColor)'); ItemDivider[h] := 0; h := AddItem('The Item''s background color inherits the CellBackColor()'); ItemDivider[h] := 0; CellBackColor[TObject(h),Nil] := $ff00; h := AddItem('The Item''s background color inherits the CellBackColor(), while the split inherits from the Column.Def(exCellBackColor) '); ItemDivider[h] := 0; CellBackColor[TObject(h),Nil] := $ff00; var_SplitCell := SplitCell[TObject(h),TObject(0)]; h := AddItem('The Item''s background color inherits the CellBackColor()'); ItemDivider[h] := 0; CellBackColor[TObject(h),Nil] := $ff00; CellBackColor[TObject(0),SplitCell[TObject(h),TObject(0)]] := $ff0000; end; end |
820 |
How can I specify a fixed width for a column
with AxGrid1 do begin MarkSearchColumn := False; TreeColumnIndex := -1; ColumnAutoResize := False; with (Columns.Add('C1') as EXGRIDLib.Column) do begin Width := 17; AllowSizing := False; end; with (Columns.Add('C2') as EXGRIDLib.Column) do begin Width := 17; AllowSizing := False; end; Columns.Add('Other'); ColumnAutoResize := True; end |
819 |
How can I split a cell in three parts
with AxGrid1 do begin BeginUpdate(); DrawGridLines := EXGRIDLib.GridLinesEnum.exAllLines; Columns.Add('Default'); with Items do begin h := AddItem('entire'); h := AddItem('split 1'); h := SplitCell[TObject(h),TObject(0)]; CellValue[TObject(0),TObject(h)] := 'split 2'; h := SplitCell[TObject(0),TObject(h)]; CellValue[TObject(0),TObject(h)] := 'split 3'; h := AddItem('entire'); end; EndUpdate(); end |
818 |
How can I find if there is any filter applied to the control
// FilterChange event - Occurs when filter was changed. procedure TWinForm1.AxGrid1_FilterChange(sender: System.Object; e: System.EventArgs); begin with AxGrid1 do begin OutputDebugString( 'If negative, the filter is present, else not' ); OutputDebugString( Items.VisibleItemCount ); end end; with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; TreeColumnIndex := -1; FilterInclude := EXGRIDLib.FilterIncludeEnum.exMatchingItemsOnly; with (Columns.Add('Column') as EXGRIDLib.Column) do begin DisplayFilterButton := True; FilterType := EXGRIDLib.FilterTypeEnum.exFilter; Filter := 'C1'; end; with Items do begin h := AddItem('R1'); InsertItem(h,Nil,'C1'); InsertItem(h,Nil,'C2'); ExpandItem[h] := True; h := AddItem('R2'); InsertItem(h,Nil,'C1'); InsertItem(h,Nil,'C2'); end; ApplyFilter(); EndUpdate(); end |
817 |
How can I prevent showing the lines for the hierarchy while using the exMatchingItemsOnly option
with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; TreeColumnIndex := -1; FilterInclude := EXGRIDLib.FilterIncludeEnum.exMatchingItemsOnly; with (Columns.Add('Column') as EXGRIDLib.Column) do begin DisplayFilterButton := True; FilterType := EXGRIDLib.FilterTypeEnum.exFilter; Filter := 'C1|C2'; end; with Items do begin h := AddItem('R1'); InsertItem(h,Nil,'C1'); InsertItem(h,Nil,'C2'); ExpandItem[h] := True; h := AddItem('R2'); InsertItem(h,Nil,'C1'); InsertItem(h,Nil,'C2'); end; ApplyFilter(); EndUpdate(); end |
816 |
Is there any method to get only the matched items and not the items with his parent
with AxGrid1 do begin BeginUpdate(); LinesAtRoot := EXGRIDLib.LinesAtRootEnum.exLinesAtRoot; FilterInclude := EXGRIDLib.FilterIncludeEnum.exMatchingItemsOnly; with (Columns.Add('Column') as EXGRIDLib.Column) do begin DisplayFilterButton := True; FilterType := EXGRIDLib.FilterTypeEnum.exFilter; Filter := 'C1|C2'; end; with Items do begin h := AddItem('R1'); InsertItem(h,Nil,'C1'); InsertItem(h,Nil,'C2'); ExpandItem[h] := True; h := AddItem('R2'); InsertItem(h,Nil,'C1'); InsertItem(h,Nil,'C2'); end; ApplyFilter(); EndUpdate(); end |
815 |
Is there any property I can save and restore automatically the current setting, column position, size, and so on (2)
with AxGrid1 do begin BeginUpdate(); Columns.Add('Column'); with Items do begin AddItem('Item 1'); AddItem('Item 2'); AddItem('Item 3'); end; Layout := 'Select="0";SingleSort="C0:2";Columns=1'; EndUpdate(); end |
814 |
Is there any property I can save and restore automatically the current setting, column position, size, and so on (1)
with AxGrid1 do begin BeginUpdate(); Columns.Add('Column'); with Items do begin AddItem('Item 1'); AddItem('Item 2'); AddItem('Item 3'); end; Layout := 'gBjAAwAAuABmABpABsAB0ABlAByhoAPIAOEPAA9gYABoABQAgUEg0XN4AOcJicKkpujMbjsfkMFk0YhkQgUOjUEl8gjcGO0ok8KMULjEaGMcj08kQAO8oMkTNEtGwAGQ' + 'Aqc7gUlhh1ABtAEsk9GpEfhElgVcsMupNlnlonlaAFcr0shUsp8QPEtnVJqJhmcIhUMh0QiU5sYAqMngUSuEMw07k8Qv0SgVRrNEuVflF2jF5x9JyNEm0TjQijemyE0j' + 'E3t+YruauoAu4Az1qj9BzRn0UzksSnAA0xDjY6qnAw8OiUQ0dwzN0zWz2t7j8/xURAGNvWH6k8xlEhklhEI0O/6QAgI='; EndUpdate(); end |
813 |
I have noticed that the column's header is changed once the cursor hovers it. Is it possible to change that visual appearance
|
812 |
Is it possible to change the visual appearance of the columns selector/floating bar(3)
with AxGrid1 do begin ColumnAutoResize := False; with Columns do begin Add('Column 1'); (Add('Column 2') as EXGRIDLib.Column).Visible := False; end; VisualAppearance.Add(2,'c:\exontrol\images\normal.ebn'); VisualAppearance.Add(3,'c:\exontrol\images\pushed.ebn'); set_Background(EXGRIDLib.BackgroundPartEnum.exColumnsFloatAppearance,$2000000); set_Background(EXGRIDLib.BackgroundPartEnum.exColumnsFloatBackColor,$3000000); set_Background(EXGRIDLib.BackgroundPartEnum.exColumnsFloatCaptionBackColor,$f0f5f6); ColumnsFloatBarVisible := EXGRIDLib.ColumnsFloatBarVisibleEnum.exColumnsFloatBarVisibleIncludeHiddenColumns; end |
811 |
Is it possible to change the visual appearance of the columns selector/floating bar(2)
with AxGrid1 do begin ColumnAutoResize := False; with Columns do begin Add('Column 1'); (Add('Column 2') as EXGRIDLib.Column).Visible := False; end; VisualAppearance.Add(3,'c:\exontrol\images\pushed.ebn'); set_Background(EXGRIDLib.BackgroundPartEnum.exColumnsFloatBackColor,$3000000); ColumnsFloatBarVisible := EXGRIDLib.ColumnsFloatBarVisibleEnum.exColumnsFloatBarVisibleIncludeHiddenColumns; end |
810 |
Is it possible to change the visual appearance of the columns selector/floating bar(1)
|
809 |
I am using the ColumnsFloatBarVisible property on True, but still not able to add any column on that list
with AxGrid1 do begin ColumnAutoResize := False; with Columns do begin Add('Column 1'); (Add('Column 2') as EXGRIDLib.Column).Visible := False; end; ColumnsFloatBarVisible := EXGRIDLib.ColumnsFloatBarVisibleEnum.exColumnsFloatBarVisibleIncludeHiddenColumns; end |
808 |
Is it possible to list a column to columns selector/floating bar, but still user can use it
with AxGrid1 do begin ColumnAutoResize := False; with Columns do begin Add('Column 1'); (Add('Column 2') as EXGRIDLib.Column).Visible := False; with (Add('Column 3') as EXGRIDLib.Column) do begin Visible := False; Enabled := False; end; end; ColumnsFloatBarVisible := EXGRIDLib.ColumnsFloatBarVisibleEnum.exColumnsFloatBarVisibleIncludeHiddenColumns; end |
807 |
How can I prevent a specific column not to be listed in the columns selector/floating bar
with AxGrid1 do begin ColumnAutoResize := False; with Columns do begin Add('Column 1'); (Add('Column 2') as EXGRIDLib.Column).Visible := False; with (Add('Column 3') as EXGRIDLib.Column) do begin Visible := False; AllowDragging := False; end; end; ColumnsFloatBarVisible := EXGRIDLib.ColumnsFloatBarVisibleEnum.exColumnsFloatBarVisibleIncludeHiddenColumns; end |
806 |
Is it possible to change the "Columns" caption being shown in the columns selector/floating bar
with AxGrid1 do begin ColumnAutoResize := False; with Columns do begin Add('Column 1'); (Add('Column 2') as EXGRIDLib.Column).Visible := False; end; set_Description(EXGRIDLib.DescriptionTypeEnum.exColumnsFloatBar,'Hidden Columns'); ColumnsFloatBarVisible := EXGRIDLib.ColumnsFloatBarVisibleEnum.exColumnsFloatBarVisibleIncludeHiddenColumns; end |
805 |
How can I show the columns selector, so the user can drag and drop columns to the view
with AxGrid1 do begin ColumnAutoResize := False; with Columns do begin Add('Column 1'); (Add('Column 2') as EXGRIDLib.Column).Visible := False; end; ColumnsFloatBarVisible := EXGRIDLib.ColumnsFloatBarVisibleEnum.exColumnsFloatBarVisibleIncludeHiddenColumns; end |
804 |
The column's header is changed while the cursor hovers it. Is it possible to prevent that
|
803 |
I noticed that when grouping on a field, its details are always expanded. Is it possible to show collapsed by default (method 2)
with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := False; rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset); with rs do begin Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil); end; DataSource := (rs as ADODB.Recordset); SortBarVisible := True; SortBarCaption := 'Drag a <b>column</b> header here to group by that column.'; AllowGroupBy := True; Columns.Item[TObject(1)].SortOrder := EXGRIDLib.SortOrderEnum.SortAscending; EndUpdate(); BeginUpdate(); EnsureVisibleColumn(TObject(0)); Items.ExpandItem[0] := False; EndUpdate(); end |
802 |
I noticed that when grouping on a field, its details are always expanded. Is it possible to show collapsed by default (method 1)
// AddGroupItem event - Occurs after a new Group Item has been inserted to Items collection. procedure TWinForm1.AxGrid1_AddGroupItem(sender: System.Object; e: AxEXGRIDLib._IGridEvents_AddGroupItemEvent); begin with AxGrid1 do begin Items.ExpandItem[e.item] := False; end end; with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := False; rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset); with rs do begin Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil); end; DataSource := (rs as ADODB.Recordset); SortBarVisible := True; SortBarCaption := 'Drag a <b>column</b> header here to group by that column.'; AllowGroupBy := True; Columns.Item[TObject(1)].SortOrder := EXGRIDLib.SortOrderEnum.SortAscending; EndUpdate(); end |
801 |
Is there a possibility to expand / collapse all groups (or group by group) at runtime with a method (equivalent to pressing the + or - button in the group header)
with AxGrid1 do begin BeginUpdate(); ColumnAutoResize := False; rs := (ComObj.CreateComObject(ComObj.ProgIDToClassID('ADOR.Recordset')) as ADODB.Recordset); with rs do begin Open('Orders','Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Program Files\Exontrol\ExGrid\Sample\Access\misc.accdb',3,3,Nil); end; DataSource := (rs as ADODB.Recordset); SortBarVisible := True; SortBarCaption := 'Drag a <b>column</b> header here to group by that column.'; AllowGroupBy := True; Columns.Item[TObject(1)].SortOrder := EXGRIDLib.SortOrderEnum.SortAscending; EndUpdate(); EnsureVisibleColumn(TObject(0)); BeginUpdate(); with Items do begin ExpandItem[RootItem[0]] := False; ExpandItem[RootItem[1]] := False; ExpandItem[RootItem[2]] := False; end; EndUpdate(); end |